/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.za.cput.xalisa.designpatterns.structural.proxy;

/**
 *
 * @author Enkosi
 */
public class Bank {

    private int numberInQueue;

    public double getMoneyForPurchase(double amountNeeded) {

        AccountHolder accountHolder = new AccountHolder("Xalisa");
        Account account = new Account();
        Long accountNumber = accountHolder.getAccountNumber();

        boolean gotPassbook = accountHolder.getPassbook();

        int number = getNumberInQueue();
        while (number != 0) {
            number--;
        }
        boolean isBalanceSufficient = account.checkBalance(accountNumber, amountNeeded);

        if (isBalanceSufficient) {
            return amountNeeded;
        } else {
            return 0;
        }
    }

    private int getNumberInQueue() {
        return numberInQueue;
    }
}
